{extends file='main.tpl'}

{block name="title"}
  <title>Modificar {$name}</title>
{/block}

{block name="content"}
  <p>
    <strong>
      Modificar usuario: {$name}
    </strong>
  </p>

  <h2>{$message}</h2>

  <a href="users.php?page=read">Ir a lista</a>

  <form name="update_password" action="{$smarty.server.PHP_SELF}" method="post">

    <div class="fhide">
      <label for="page">Page: </label>
      <input type="text" name="page" value="update"/>
    </div>

    <div class="fhide">
      <label for="id">Id: </label>
      <input type="text" name="id" value="{$id}"/>
    </div>

    <div>
      <label for="password">Contraseña: </label>
      <input type="text" name="password" value="{$password}"/>
    </div>

    <div>
      <input type="submit" value="Modificar contraseña">
    </div>
  </form>

  {if $rol=='1'}
    <form name="update_to_admin" action="{$smarty.server.PHP_SELF}" method="post">

      <div class="fhide">
        <label for="page">Page: </label>
        <input type="text" name="page" value="update"/>
      </div>

      <div class="fhide">
        <label for="id">Id: </label>
        <input type="text" name="id" value="{$id}"/>
      </div>

      <div class="fhide">
        <label for="rol">Volver admin: </label>
        <input type="text" name="rol" value="0"/>
      </div>

      <div>
        <input type="submit" value="Volver admin">
      </div>
    </form>
  {/if}

  {if $rol=='0'}
    <form name="update_to_client" action="{$smarty.server.PHP_SELF}" method="post">

      <div class="fhide">
        <label for="page">Page: </label>
        <input type="text" name="page" value="update"/>
      </div>

      <div class="fhide">
        <label for="id">Id: </label>
        <input type="text" name="id" value="{$id}"/>
      </div>

      <div class="fhide">
        <label for="rol">Volver cliente: </label>
        <input type="text" name="rol" value="1"/>
      </div>

      <div>
        <input type="submit" value="Volver cliente">
      </div>
    </form>
  {/if}

  {if $softDelete=='1'}
    <form name="enable" action="{$smarty.server.PHP_SELF}" method="post">

      <div class="fhide">
        <label for="page">Page: </label>
        <input type="text" name="page" value="update"/>
      </div>

      <div class="fhide">
        <label for="id">Id: </label>
        <input type="text" name="id" value="{$id}"/>
      </div>

      <div class="fhide">
        <label for="softDelete">Habilitar: </label>
        <input type="text" name="softDelete" value="0"/>
      </div>

      <div>
        <input type="submit" value="Habilitar">
      </div>
    </form>
  {/if}

  {if $softDelete=='0'}
    <form name="disable" action="{$smarty.server.PHP_SELF}" method="post">

      <div class="fhide">
        <label for="page">Page: </label>
        <input type="text" name="page" value="update"/>
      </div>

      <div class="fhide">
        <label for="id">Id: </label>
        <input type="text" name="id" value="{$id}"/>
      </div>

      <div class="fhide">
        <label for="softDelete">Deshabilitar: </label>
        <input type="text" name="softDelete" value="1"/>
      </div>

      <div>
        <input type="submit" value="Deshabilitar">
      </div>
    </form>
  {/if}
{/block}